@extends('layouts/admin')
    @section('content')
        <!--面包屑导航 开始-->
        <div class="crumb_warp">
            <i class="fa fa-home"></i> <a href="{{url('admin/info')}}">首页</a> &raquo; 配置项管理
        </div>
        <!--面包屑导航 结束-->

        <!--结果集标题与导航组件 开始-->
        <div class="result_wrap">
            <div class="result_title">
                <h3>添加配置项</h3>
            </div>
            <div class="result_content">
                <div class="short_wrap">
                    <a href="{{url('admin/config/create')}}"><i class="fa fa-plus"></i>添加配置项</a>
                    <a href="{{url('admin/config')}}"><i class="fa fa-fw fa-list-ul"></i>全部配置项</a>
                </div>
            </div>
        </div>
        <!--结果集标题与导航组件 结束-->
        @if(count($errors))
        <div class="result_title">
                <div class="mark">
                    @if(is_object($errors))
                        @foreach($errors->all() as $error)
                            <p style="color: red;">{{$error}}</p>
                        @endforeach
                    @else
                        <p style="color: red;">{{$errors}}</p>
                    @endif
                </div>
        </div>
        @endif
        <div class="result_wrap">
            <form action="{{url('admin/config')}}" method="post" enctype="multipart/form-data">
                {{csrf_field()}}
                <table class="add_tab">
                    <tbody>
                        <tr>
                            <th>标题：</th>
                            <td>
                                <input type="text" class="lg" name="conf_title">
                            </td>
                        </tr>
                        <tr>
                            <th>变量名：</th>
                            <td>
                                <input type="text" class="sm" name="conf_name">
                            </td>
                        </tr>
                        <tr>
                            <th>变量值：</th>
                            <td>
                                <input type="text" class="lg" name="conf_content">
                            </td>
                        </tr>
                        <tr>
                            <th>类型：</th>
                            <td>
                                <input type="radio" name="field_type" value="input" onclick="show()">input
                                <input type="radio" name="field_type" value="textarea" onclick="show()">textarea
                                <input type="radio" name="field_type" value="radio" checked="checked" onclick="show()">radio
                            </td>
                        </tr>
                        <tr id="field_value">
                            <th>类型值：</th>
                            <td>
                                <input type="text" name="field_value" class="lg">
                            </td>
                        </tr>
                        <tr>
                            <th>说明：</th>
                            <td>
                                <textarea name="conf_tips"></textarea>
                            </td>
                        </tr>
                        <tr>
                            <th>排序：</th>
                            <td>
                                <input type="text" name="conf_order" class="sm" value="0">
                            </td>
                        </tr>
                        <tr>
                            <th></th>
                            <td>
                                <input type="submit" value="提交">
                                <input type="button" class="back" onclick="history.go(-1)" value="返回">
                            </td>
                        </tr>
                    </tbody>
                </table>
            </form>
        </div>
        <script type="text/javascript">
        window.onload = show;
            function show(){
                var checked = $('input[name=field_type]:checked').val();
                if(checked == 'radio'){
                    $('#field_value').show();
                }else{
                    $('#field_value').hide();
                }
            }
        </script>
    @endsection